// dlg.txt

begintalkscript;

variables;

begintalknode 1;
	state = -1;
	nextstate = -1;
	condition = get_sdf(6,2) == 0;
	question = "special";
	text1 = "You are in the eastern section of the Foundry Core. You don't think you have ever been here, but you've heard what it is for. It is where new, experimental creation types are brought for testing and evaluation.";
	text2 = "Sometimes, this testing process can be very harsh. It's not just taking samples of skin and blood. Creations intended for battle are expected to fight and to withstand pain and physical punishment.";
	text3 = "This main walkway is eerily still and dark. You don't hear the expected sounds of working serviles and carts being pulled over the stone floors. All you can hear are the hisses and snarls of rogues, abandoned by their masters.";
	action = SET_SDF 6 2 1;

begintalknode 2;
	state = -1;
	nextstate = -1;
	condition = get_sdf(6,3) == 0;
	question = "special";
	text1 = "There are a bunch of heavily modified beetles drinking from the pool to the south. They are nasty creatures, larger than the ones you fought earlier.";
	text2 = "They haven't noticed you yet. You could avoid them if you keep your distance. Of course, that would leave them there, ready to attack the next worker who passes through.";
	action = SET_SDF 6 3 1;

begintalknode 3;
	state = -1;
	nextstate = -1;
	condition = get_sdf(6,4) == 0 && gf(6,9) == 0;
	question = "special";
	text1 = "To the north, you see the main door into the testing area. Something exploded here. The walls are covered with cracks, although the door itself survived.";
	text2 = "You can see light flickering through the cracks. If you got closer, you might be able to see something through them.";
	action = SET_SDF 6 4 1;

begintalknode 4;
	state = -1;
	nextstate = -1;
	condition = get_sdf(6,5) == 0 && gf(6,9) == 0;
	question = "special";
	text1 = "You lean close to one of the cracks, press your eye against it, and see if you can see anything of interest.";
	text2 = "You do. There is a control chamber. You can see a large chamber with some sort of control panel in the center.";
	text3 = "What is more interesting is the creature walking around the panel. It looks like a fyora, but it is acting strangely. It walks more upright, with more purpose. Occasionally, it walks up to the panel and jabs or pushes something.";
	text4 = "Then the fyora stops. It shudders slightly. A glowing nimbus starts to rise out of its head. It raises its foreclaws, grabs the insubstantial form, and pulls it back down into its head. Then it returns to the panel.";
	text5 = "You look at Mehken. She is watching the creature through a different crack. She steps back and shudders. _Being near it, I feel it. Makes me feel ... We must destroy it._";
	text6 = "Very strange. You suspect that the Presence you are hunting is not far away.";
	action = SET_SDF 6 5 1;
	code =
		if (char_in_party(47) < 0)
			rs(5);
	break;

begintalknode 5;
	state = -1;
	nextstate = -1;
	condition = get_sdf(6,6) == 0;
	question = "special";
	text1 = "There is a low platform in the center of this room. Creations are chained there for easy inspection, sample taking, and so on.";
	text2 = "Unfortunately, several fyoras have gotten loose and are hunting for prey here. The Presence has driven them completely rogue. However, the room is dark and wide. If you don't want to fight them, you might be able to sneak by.";
	text3 = "(Some enemies are unobservant. They can be passed with stealth. The longer you are close to them, the higher the chance of them noticing you. When an enemy starts to suspect that you are nearby, a '?' will appear above its head.)";
	action = SET_SDF 6 6 1;

begintalknode 6;
	state = -1;
	nextstate = -1;
	condition = get_sdf(6,7) == 0;
	question = "special";
	text1 = "There is a scattering of crystal containers on the floor ahead, full of glowing essence. They contain embryonic creations, ready to emerge fully developed.";
	text2 = "Unfortunately, someone has dragged them here and hooked them up to several jury-rigged triggers. You have the grim suspicion that, if you get close to the triggers, the containers will be activated.";
	text3 = "Mehken looks at one of them closely. _Are small. Not much essence. If rogue comes out, we can kill it, I think. If you can't disarm it._";
	text4 = "(If you don't have enough Mechanics skill to deactivate the containers, you will have to fight the creations within. It is your choice how to proceed.)";
	action = SET_SDF 6 7 1;
	code =
		if (char_in_party(47) < 0)
			rs(3);
	break;
	
begintalknode 7;
	state = -1;
	nextstate = -1;
	condition = get_sdf(6,8) == 0;
	question = "special";
	text1 = "This huge cavern is like an arena. Creations designed for warfare are brought here and pitted against weaker enemies to test their skills.";
	text2 = "It is against Shaper law to pit creations against each other for sport or amusement. Testing is, apparently, different.";
	text3 = "As you look around for enemies, something happens. You hear a click and a hum. The conduits on the floor begin to glow.";
	text4 = "Someone or something has activated some sort of defense. It is not immediately clear how it works, though.";
	action = SET_SDF 6 8 1;

begintalknode 8;
	state = -1;
	nextstate = -1;
	condition = get_sdf(6,10) == 0;
	question = "special";
	text1 = "The passage to the south is blocked by several field pylons. They look very powerful. Trying to proceed to the south without finding a way to disarm them would be suicidal.";
	action = SET_SDF 6 10 1;


begintalknode 10;
	state = -1;
	nextstate = 10;
	condition = gf(6,11) == 0 && gf(6,9) == 0 && gf(6,14) == 0;
	question = "Name";
	text1 = "The door to the north has a sign next to it: _Testing Halls. Main Entrance._";
	text2 = "The door is solid stone, very heavy of Shaper make. A huge, heavily altered tree-fungus creature lives inside it, dropping and lifting the stone as needed. Left alone, it would live and function for many years.";
	text3 = "When you get close to the door, it slides open slightly. When you get closer, it opens more. It seems to want to let you through. Someone seems to be controlling it from a distance.";
	text4 = "If you went inside, the door might close, trapping you. It all depends on how its controller feels about you.";
	action = SET_SDF 6 14 2;
	
begintalknode 11;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "Don't enter.";
	text1 = "You decide to take the cautious course and stay out here.";
	action = END_TALK;
	
begintalknode 12;
	state = 10;
	nextstate = -1;
	condition = 1;
	question = "Go through the door.";
	text1 = "You approach the door. It opens all the way. You step through.";
	action = END_TALK;
	code =
		sf(6,11,1);
		sf(6,12,1);
		sf(6,22,1);
		char_clear_action(1000);
		
		toggle_cutscene(1);
	break;
	
begintalknode 13;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "Once you are inside the testing halls, the door behind you slides shut. It doesn't open again.";
	text2 = "It is silent and dark, except for the sounds of claws scraping over stone in the shadows ahead. Something has trapped you in here with it. Now you will have to show it the magnitude of its error.";

begintalknode 14;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "You check the scrying crystal. It is glowing faintly.";
	text2 = "The Presence is nearby.";
	
begintalknode 15;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "";	
	
begintalknode 20;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "The obelisk says:";
	text2 = "  Deposit Creations For Evaluation Here";
	text3 = "  Creations Will Be Restrained By Workers";
	text4 = "  Collect Processed Creations/Remains At West Exit";
	
begintalknode 21;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "You examine this peculiar device. It seems to be used to open and close the rows of cells along the edge of the room. You poke at the controls, but nothing happens. They seem to have been overridden from somewhere else.";
	
begintalknode 22;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "When you get close to this piece of machinery, it beeps a little. Then one of the controls on its side starts to move, seemingly on its own. Something must be controlling it from a distance.";
	text2 = "The control slides into place with a click. Several sections of a nearby wall slide away, revealing cells on the other side.";
	
begintalknode 23;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "You enter the control chamber for the testing halls. The room is dominated by a large Shaper control panel. Like all of the Shapers' best inventions, it is a living thing. A huge, fungal lump, resting in a stone tray.";
	text2 = "The buttons and levers are all woody projections. The creature shifts around slowly, occasionally letting out a puff of noxious gas. It has a hole at one end, probably to take in nutrients.";
	text3 = "As you look at the strange thing, a creature rises up behind it. It is a fyora, the same one you saw through the cracks in the south wall. It inspects you, its eyes betray a worryingly keen intelligence inside its reptilian head.";
	text4 = "As you look at the strange thing, a creature rises up behind it. It looks like a fyora, but it is acting strangely. It walks more upright, with more purpose. Its eyes betray a worryingly keen intelligence inside its reptilian head.";
	text5 = "Then the fyora stops. It shudders slightly. A glowing nimbus starts to rise out of its head. It raises its foreclaws, grabs the insubstantial form, and pulls it back down into its head. Then it returns to the panel.";
	text6 = "Mehken grips her blade tightly. You hear her whisper to herself, _I will be in control. Be in control. Be in control._";
	text7 = "The creature reaches out and grabs a wooden lever. It knows how to use the controls. You brace yourself for a fresh assault.";
	code =
		if (char_in_party(47) < 0)
			rs(6);
		if (gf(6,4) == 0)
			rs(3);
			else {
				rs(4);
				rs(5);
				}
	break;
	
begintalknode 24;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "The strange fyora stares at you. The nimbus of mist emerges from its head again. You prepare to ... to ...";
	text2 = "You stumble backward. The confusion in your head that has been afflicting you doubles and doubles again. This must be the Presence that has been assaulting the Foundry, bringing madness wherever it goes.";
	text3 = "The Presence begins to sink back into the fyora's head. It doesn't fade entirely, though. A tiny tendril extends out of the fyora's head, ready to lash out at a target ...";
	
begintalknode 25;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "The fyora yanks the lever with its foreclaw, ready to use the power of the Shaper machinery against you. It looks expectantly at the two platforms to the south.";
	text2 = "Nothing happens.";
	text3 = "The creature instantly realizes that you managed to cut out the power. It lets out a long, furious hiss.";
	
begintalknode 26;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "The fyora yanks the lever with its foreclaw, ready to use the power of the Shaper machinery against you. It looks expectantly at the two platforms to the south.";
	text2 = "That bit of distraction is fatal. When the bolt of energy flows out of the conduits, through the panel, and up the fyora's arm, it doesn't pull away quickly enough.";
	text3 = "The creature lets out a bone-chilling screech. Its body is starting to disintegrate, rapidly reverting to essence and goo. It turns to you, determined to try to kill you before it expires.";
	
begintalknode 27;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "The fyora yanks the lever with its foreclaw, ready to use the power of the Shaper machinery against you. It looks expectantly at the two platforms to the south.";
	text2 = "Two creations slowly coalesce into view on the platforms. They are only augmented beetles, minor pests, but they will provide an irritating distraction while you try to deal with the fyora.";
	
begintalknode 28;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "You have succeeded in dealing massive damage to the fyora's body. The Presence can no longer remain in it. It withdraws. A long stream of mist flows out of the fyora's head and fades into invisibility.";
	text2 = "Not all of the Presence gets away, though. When the fyora dies, the flow of mist is cut off. Some of it is trapped in the corpse.";
	text3 = "The Presence is gone, fled somewhere else in the complex. You suspect that you might have actually hurt the thing.";
	text4 = "You hear a click from the south door. Now that the fyora isn't at the controls anymore, the door will work properly.";
	
begintalknode 29;
	state = -1;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = "";	
	
//

begintalknode 30;
	state = -1;
	nextstate = 30;
	condition = gf(6,9) == 0 && gf(6,0) == 0;
	question = "Name";
	text1 = "This small chamber is dominated by a Shaper control panel, one of their huge, fungal monstrosities. Power conduits emerge from it on all sides, and it is covered with wooden switches and levers.";
	text2 = "It is fused to the south wall, as if it controls something on the other side. You know enough about Mechanics to be able to tell that it controls the flow of power to the other side.";
	text3 = "Now that you have sabotaged it, there is nothing else you can do here.";
	code =
		sf(6,0,2);
		if (gf(6,13) < 2)
			rs(3);
	break;
	
begintalknode 31;
	state = 30;
	nextstate = -1;
	condition = gf(6,13) == 0;
	question = "Cut off the power. (Use 1 living tool.)";
	text1 = "You try to cut the power, but you don't have a living tool.";
	text2 = "It is easier to destroy than to create. With your experience with Shaper machinery, you easily find a delicate point at which to insert the living tool.";
	text3 = "A squealing noise and a cloud of smoke later, the power flow to the south is cut. Anyone there won't immediately notice a problem. When they try to actually use the machinery, however, they will be disappointed.";
	action = END_TALK;
	code =
		if (has_item(255) == 0) {
			rs(2);
			rs(3);
			}
			else {
				rs(1);
				take_item(255);
				sf(6,13,1);
				award_party_xp(100,2);
				}
	break;

begintalknode 32;
	state = 30;
	nextstate = -1;
	condition = gf(6,13) == 1;
	question = "Sabotage the power flow.";
	text1 = "After the damage you have done, you won't be able to do anything more delicate.";

begintalknode 33;
	state = 30;
	nextstate = -1;
	condition = gf(6,13) == 0 && get_stat(21) < 6;
	question = "Sabotage the power flow.";
	text1 = "You try to figure out how to get control of the power flow. Unfortunately, you are hampered by a lack of familiarity with this machinery and a desire not to incinerate yourself.";
	text2 = "You abandon your efforts.";

begintalknode 34;
	state = 30;
	nextstate = -1;
	condition = gf(6,13) == 0 && get_stat(21) >= 6;
	question = "Sabotage the power flow. (Use 2 living tools.)";
	text1 = "You try to rework the power flow, but you don't have two living tools.";
	text2 = "You get on your knees, try to concentrate, and get to work revising the power flow. It takes some effort to get your brain to work properly, but you manage to figure out how to do it.";
	text3 = "To someone on the south side of this wall, everything will appear to be working normally until they actually try something that takes real power. When they do, they will get an unpleasant surprise.";
	action = END_TALK;
	code =
		if (num_of_item(255) < 2) {
			rs(2);
			rs(3);
			}
			else {
				rs(1);
				take_item(255);
				take_item(255);
				sf(6,13,2);
				award_party_xp(200,2);
				}
	break;

begintalknode 35;
	state = 30;
	nextstate = -1;
	condition = 1;
	question = "Leave.";
	text1 = "You leave the machinery alone. The panel twitches and throbs unwholesomely as you back away.";
	action = END_TALK;

	
//

begintalknode 50;
	state = -1;
	nextstate = 50;
	condition = is_group() && char_in_party(47) >= 0 && gf(6,28) == 0;
	question = "Name";
	text1 = "Mehken unexpectedly breaks the silence. _I have not been here in a long time. I do not like it. Not like it here at all._";
	action = SET_SDF 6 28 1;

begintalknode 51;
	state = 50;
	nextstate = 51;
	condition = 1;
	question = "Why?";
	text1 = "_The creations are brought here. Tested. It is harsh. They cry out. Sometimes go rogue. Many never leave. It is hard to hear._";
	text2 = "_Would rather be outside. Looking after them._";

	
begintalknode 52;
	state = 50;
	nextstate = -1;
	condition = 1;
	question = "This isn't a good time to talk.";
	text1 = "Mehken nods. _You are right._ She is silent again.";
	action = END_TALK;
	
begintalknode 53;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "Why does being out there make a difference?";
	text1 = "_Their fate is the same, but is easier if I can forget it happens. Easier for me._";
	text2 = "_Am not proud of it._";
	
begintalknode 54;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "If the Shapers will do their work, they need to test the things they make.";
	text1 = "_And those things? They have no say in the matter? While they are ..._";
	text2 = "Mehken shakes her head. _No. Enough talking. Need to hunt the Presence, before it does more harm._";
	action = END_TALK;
	code = 
		inc_flag(100,0,1);
	break;
	
begintalknode 55;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "You are right. It is horrifying.";
	text1 = "Mehken nods. _But nothing to be done. The Shapers can't be defeated. Or, so they say anyway._";
	text2 = "_No. Enough talking. Need to hunt the Presence, before it does more harm._";
	code = 
		inc_flag(100,0,-1);
	break;
	action = END_TALK;
	
begintalknode 56;
	state = 51;
	nextstate = -1;
	condition = 1;
	question = "I just try not to think about it.";
	text1 = "_Yes. Is your fate. You spend much time not thinking. You weren't able. But someday, soon, you will think again. And then you will have to decide things._";
	text2 = "Mehken shakes her head. _Enough talking. Need to hunt the Presence, before it does more harm._";
	action = END_TALK;


//

begintalknode 70;
	state = -1;
	nextstate = 70;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 71;
	state = 70;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";

//

begintalknode 90;
	state = -1;
	nextstate = 90;
	condition = 1;
	question = "Name";
	text1 = ".";
	text2 = "";
	text5 = ".";
	action = INTRO;

begintalknode 91;
	state = 90;
	nextstate = -1;
	condition = 1;
	question = "";
	text1 = ".";
	text2 = "";
		